'use strict'
const Core = require('@alicloud/pop-core');
const Service = require('egg').Service
class UserService extends Service {
    // 发送短信
    async sendCode(params) {

        let client = new Core({
            accessKeyId: 'LTAI2z0Fz68J3cgG',
            accessKeySecret: 'CQjCNFCycANe9SiHsMRj6tH0hkGXth',
            endpoint: 'https://dysmsapi.aliyuncs.com',
            apiVersion: '2017-05-25'
        });
        let requestOption = {
            method: 'POST'
        };

        return await client.request('SendSms', params, requestOption).then((result) => {
            return result
        }, (ex) => {
            return ex.name
        })
    }
}

module.exports = UserService
